package DataStructures;


public class Queue<T> {
	
	private Node <T> front;
	private Node <T> back;
	private int cont;
	
	public Queue(){
		
		front = null;
		back = null;
		cont =0;
	}
	
	public boolean isEmpty(){
		
		boolean result = false;
		
		if (front == null)
			result = true;
		return result;
	}
	
	public void add(T e){
		
		Node <T> temp = new Node<T>(e);
		if (isEmpty()){
			cont++;
			front = temp;
			back = temp;
		}
		else{
			cont++;
			back.next = temp;
			back = temp;
		}
	}
	
	public void print (){
		
		Node <T> run = front;
		while (run != null){
			
			System.out.println(run.data);
			run = run.next;
		}
	}
}
